
package ProOF.apl.problems.real.functions;

import ProOF.com.LinkerParameters;

/**
 *
 * @author Hossomi
 */
public class RealFuncGRP extends aRealFunction{

	@Override
	public void parameters(LinkerParameters link) throws Exception {

	}
	
	@Override
	public int dimension() {
		return 3;
	}
	
	@Override
	public double min( int i ) {
		if (i == 0)
            return 0.1;
        
        return 0.0;
	}
	
	@Override
	public double max( int i ) {
		switch (i) {
            case 0: return 100;
            case 1: return 25.6;
            case 2: return 5.0;
        }
        
        return 0.0;
	}

	@Override
	public double f(double[] x) throws Exception {
		check(x);
        
        double u;
        double sum = 0;
        
        for (int i = 1; i <= 99; i++) {
            u = 25 + Math.pow(-50*Math.log(0.01*i), 2.0/3);
            sum += Math.pow(Math.exp(-Math.pow(u - x[1], x[2])/x[0]) - 0.01*i, 2);
        }
        
        return sum;
	}

	@Override
	public String name() {
		return "GRP";
	}

	@Override
	public String description() {
		return "Gulf research problem";
	}	
}
